//package com.njcky.controller;
//
//import com.alibaba.fastjson.JSONObject;
//import com.njcky.model.Route;
//import com.njcky.model.View;
//import com.njcky.model.dto.*;
////import com.njcky.model.dto.MultiTypeReqDto;
//import com.njcky.service.JianJunRoadDemoService;
//
//import com.njcky.service.impl.JianJunRoadDemoServiceImpl;
//import com.njcky.utils.page.AjaxResult;
//import com.njcky.utils.page.BaseController;
//import com.njcky.utils.page.StringUtils;
//import com.njcky.utils.page.entity.TableDataInfo;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.util.ObjectUtils;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Map;
//import java.util.stream.Collectors;
//
///**
// * 当前使用模块优化在ProjectPptimizationController
// * TODO 为优化前的版本
// */
//@RestController
////@RequestMapping("/ycjjl")
//@RequestMapping("/ycjjl_demo")
//public class JianJunRoadDemoController extends BaseController {
//
//    @Value("${url.hdmurl}")
//    private String hdmurl;
//
//    @Value("${url.zdmurl}")
//    private String zdmurl;
//
//    @Autowired
//    JianJunRoadDemoServiceImpl serviceImpl;
//
//
//    @Autowired(required = false)
//    private JianJunRoadDemoService jianJunRoadDemoService;
//
//    @GetMapping("/getviewptlist")
//    public TableDataInfo getviewptlist(String vname, String userid, Integer pageSize, Integer pageNum) {
//        if (pageSize != null && pageNum != null) {
//            return getDataTableByMyself(jianJunRoadDemoService.getviewptlist(vname, userid), pageSize, pageNum);
//        }
//        return getDataTable(jianJunRoadDemoService.getviewptlist(vname, userid));
//    }
//
//    @PostMapping("/saveviewpt")
//    public AjaxResult saveviewpt(@RequestBody View view) {
//        if (StringUtils.isEmpty(view.getVname())) {
//            return AjaxResult.error(501, "名称不能为空");
//        }
//        if (StringUtils.isEmpty(view.getTmppic())) {
//            return AjaxResult.error(501, "图片地址不能为空");
//        }
//        return toAjax(jianJunRoadDemoService.saveviewpt(view));
//    }
//
//    @GetMapping("/delviewpt")
//    public AjaxResult delviewpt(@RequestParam("id") String id) {
//        return toAjax(jianJunRoadDemoService.delviewpt(id));
//    }
//
//    @GetMapping("/getroutelist")
//    public TableDataInfo getroutelist(Route route) {
//        if (route.getPageSize() != null && route.getPageNum() != null) {
//            return getDataTableByMyself(jianJunRoadDemoService.getroutelist(route), route.getPageSize(), route.getPageNum());
//        }
//        return getDataTable(jianJunRoadDemoService.getroutelist(route));
//    }
//
//    @PostMapping("/saveroute")
//    public AjaxResult saveroute(@RequestBody Route route) {
//        if (StringUtils.isEmpty(route.getRouteName())) {
//            return AjaxResult.error(501, "路线名称不能为空");
//        }
//        if (StringUtils.isEmpty(route.getRoutePoint())) {
//            return AjaxResult.error(501, "路线信息不能为空");
//        }
//        return toAjax(jianJunRoadDemoService.saveroute(route));
//    }
//
//    @GetMapping("/delroute")
//    public AjaxResult delroute(@RequestParam("id") String id) {
//        return toAjax(jianJunRoadDemoService.delroute(id));
//    }
//
//    @GetMapping("/queryRangeByLabel")
//    public AjaxResult queryRangeByLabel(InParamDto inParamDto) {
//        return AjaxResult.success(jianJunRoadDemoService.queryRangeByLabel(inParamDto));
//    }
//
//    @GetMapping("/queryRangeByClick")
//    public AjaxResult queryRangeByClick(ClickDto clickDto) {
//        if (ObjectUtils.isEmpty(clickDto.getList())) {
//            return AjaxResult.error(501, "数据集不能为空");
//        }
//        return AjaxResult.success(jianJunRoadDemoService.queryRangeByClick(clickDto));
//    }
//
//    @PostMapping("/connectivity1")
//    public AjaxResult connectivity(@RequestBody NodeInfo nodeInfo) {
//        List<Map<String, Object>> objects = jianJunRoadDemoService.connectivity(nodeInfo);
//        if (objects == null) {
//            return AjaxResult.error("不连通");
//        }
//        return AjaxResult.success(objects);
//    }
//
//
////    // TODO 连通性分析整改
////    @PostMapping("/connectivity")
////    public AjaxResult connectivity(@RequestBody QueryPipelineLengthDTO dto) {
////        TableDataInfo objects = spatialQueryService.connectivityPublic(dto);
////        if (objects == null) {
////            return AjaxResult.error("不连通");
////        }
////        return AjaxResult.success(objects);
////    }
//
////    // TODO 连通性分析整改（当前使用的是这个）
////    @PostMapping("/connectivity")
////    public AjaxResult connectivityPublicResp(@RequestBody QueryPipelineLengthDTO dto) {
////        Map<String, Object> objects = spatialQueryService.connectivityPublicResp(dto);
////        if (objects == null) {
////            return AjaxResult.error("不连通");
////        }
////        return AjaxResult.success(objects);
////    }
//
//
//
//
//
//    @GetMapping("/lyfx")
//    public AjaxResult lyfx(NodeInfo nodeInfo) {
//        return AjaxResult.success(jianJunRoadDemoService.lyfx(nodeInfo));
//    }
//
//    @PostMapping("/queryByTreeList")
//    public AjaxResult queryByTreeList(@RequestBody InParamDto inParamDto) {
//        if (ObjectUtils.isEmpty(inParamDto.getIds())) {
//            return AjaxResult.error(501, "数据集不能为空");
//        }
//        return AjaxResult.success(jianJunRoadDemoService.queryByTreeList(inParamDto));
//    }
//
//    @PostMapping("/queryDetailByTreeList")
//    public TableDataInfo queryDetailByTreeList(@RequestBody InParamDto inParamDto) {
//        if (ObjectUtils.isEmpty(inParamDto.getTables())) {
//            //return AjaxResult.error(501,"数据集不能为空");
//            return paramCheck("数据集不能为空");
//        }
//        if (inParamDto.getHistoryQueryParam() != null && inParamDto.getHistoryQueryParamValue() != null && inParamDto.getHistoryQueryParam().size() != inParamDto.getHistoryQueryParamValue().size()) {
//            return paramCheck("属性值与字段数量不一致");
//        }
//
//        //return AjaxResult.success(jianJunRoadDemoService.queryDetailByTreeList(inParamDto));
//        //return getDataTableByMyself(jianJunRoadDemoService.queryDetailByTreeList(inParamDto),inParamDto.getPageSize(),inParamDto.getPageNum());
//        List<Map<String, Object>> resultList = jianJunRoadDemoService.queryDetailByTreeList(inParamDto);
//        TableDataInfo t = getDataTableByMyself(resultList, inParamDto.getPageSize(), inParamDto.getPageNum());
//        //先分页再转换 否则数据多转换太慢
////        //        //        System.out.println("start2");
//        List<Map<String, Object>> mapList = resultList.stream().skip((inParamDto.getPageNum() - 1) * inParamDto.getPageSize()).limit(inParamDto.getPageSize()).collect(Collectors.toList());
////        //        //        System.out.println(mapList.size());
//        for (Map<String, Object> m : mapList) {
//            if (StringUtils.isNotEmpty(m.get("shapetext").toString())) {
//                m.put("shapetext", serviceImpl.getCoordinateJWD(m.get("shapetext").toString()));
//            }
//        }
//
//        t.setData(mapList);
//        return t;
//    }
//
//    @PostMapping("/attributeSearch")
//    public TableDataInfo attributeSearch(@RequestBody InParamDto inParamDto) {
//        if (ObjectUtils.isEmpty(inParamDto.getTables())) {
//            return paramCheck("数据集不能为空");
//        }
//        if (inParamDto.getHistoryQueryParam() != null && inParamDto.getHistoryQueryParamValue() != null && inParamDto.getHistoryQueryParam().size() != inParamDto.getHistoryQueryParamValue().size()) {
//            return paramCheck("属性值与字段数量不一致");
//        }
//        List<Map<String, Object>> resultList = jianJunRoadDemoService.attributeSearch(inParamDto);
//        TableDataInfo t = getDataTableByMyself(resultList, inParamDto.getPageSize(), inParamDto.getPageNum());
//        //先分页再转换 否则数据多转换太慢
//        List<Map<String, Object>> mapList = resultList.stream().skip((inParamDto.getPageNum() - 1) * inParamDto.getPageSize()).limit(inParamDto.getPageSize()).collect(Collectors.toList());
//        for (Map<String, Object> m : mapList) {
//            if (StringUtils.isNotEmpty(m.get("shapetext").toString())) {
//                m.put("shapetext", serviceImpl.getCoordinateJWD(m.get("shapetext").toString()));
//            }
//        }
//
//        t.setData(mapList);
//        return t;
//    }
//
//    @PostMapping("/queryRangeByBuffer")
//    public AjaxResult queryRangeByBuffer(@RequestBody QueryBufferDto queryBufferDto) {
//        return AjaxResult.success(jianJunRoadDemoService.queryRangeByBuffer(queryBufferDto));
//    }
//
//    //横断面分析", notes = "【v1.0.2】 横断面分析，返回与传入线相交的管线的各种计算数据"
//    @PostMapping("/queryCrossSectionAnalysis")
//    public AjaxResult queryCrossSectionAnalysis(@RequestBody MultiTypeReqDto req) throws Exception {
//        String spatialDtoWKT = req.getGeoCompareModels().get(0).getGeoValueFilter().getGeoValue();
////        //        //        System.out.println("point:" + spatialDtoWKT);
//        AjaxResult re = new AjaxResult(200, "操作成功", jianJunRoadDemoService.queryCrossSectionAnalysis(req));
//        re.put("distance", serviceImpl.calcDistance(spatialDtoWKT));
//        re.put("url", hdmurl);
////        return AjaxResult.success(jianJunRoadDemoService.queryCrossSectionAnalysis(req));
//        return re;
//    }
//
//    //传入typeName和id，去查询该字段的管线的信息，获取相连点的数据，然后通过相连点的数据去查询管线的信息，递归调用直到找到点的索引为5
//    @PostMapping("/querySectionAnalysis")
//    public AjaxResult querySectionAnalysis(@RequestBody SectionAnalysisDto sectionAnalysisDto) {
//        AjaxResult re = new AjaxResult(200, "操作成功", jianJunRoadDemoService.querySectionAnalysis(sectionAnalysisDto));
//        re.put("url", zdmurl);
//        return re;
//    }
//
//    @GetMapping("/timeFieldQuery")
//    public AjaxResult timeFieldQuery() {
//        return AjaxResult.success(jianJunRoadDemoService.timeFieldQuery());
//    }
//
//    @GetMapping("/test")
//    public AjaxResult test() {
//        return AjaxResult.success("测试接口调用成功！");
//    }
//
////
////    /**
////     * 根据两点的距离获取管线的长度
////     *
////     * @return
////     */
////    @PostMapping("/queryPipelineNetworkSpacing")
////    public AjaxResult queryPipelineLength(@RequestBody QueryPipelineLengthDTO dto) {
////        if (spatialQueryService.queryMain(dto) != null) {
////            return AjaxResult.success(spatialQueryService.queryMain(dto));
////        }
////        return AjaxResult.success(400, "两点不在一根管线上，请确认!", new ArrayList<>());
////    }
//
//
//}
